import Vue from "vue"
import VueRouter from "vue-router"
Vue.use(VueRouter)

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (location, onResolve, onReject) {
    if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject)
    return originalPush.call(this, location).catch(err => err)
}

const routes=[
   
    {path:'/login',component:()=>import("../view/login/Login")},
    {path:'/',component:()=>import("../view/layout/LayOut"),
      redirect:"/welcome",
      children:[
       {path:'/welcome',component:()=>import("../view/system/index")},
        {path:'/users',component:()=>import("../view/system/user")},
        {path:'/attachments',component:()=>import("../view/system/attachments")},
        {path:'/menus',component:()=>import("../view/system/menu")},
        {path:'/roles',component:()=>import("../view/system/roles")},
        {path:'/departments',component:()=>import("../view/system/departments")},
        {path:'/inStocks',component:()=>import("../view/work/inStocks")},
        {path:'/products',component:()=>import("../view/work/products")},
        {path:'/productCategorys',component:()=>import("../view/work/category")},
        {path:'/outStocks',component:()=>import("../view/work/outStocks")},
        {path:'/stocks',component:()=>import("../view/work/stocks")},
        {path:'/consumers',component:()=>import("../view/work/consumers")},
        {path:'/suppliers',component:()=>import("../view/work/origin")},
        {path:'/map',component:()=>import("../view/heathy/map")},
        {path:'/health',component:()=>import("../view/heathy/heath")},
        {path:'/rumors',component:()=>import("../view/heathy/rumors")},
        {path:'/loginLog',component:()=>import("../view/log/loginLog")},
        {path:'/logs',component:()=>import("../view/log/operationLog")},
        {path:'/out-stocks',component:()=>import("../view/work/out-stocks")},
      ]
  
  }
     
]
const router = new VueRouter({
    mode:"history",
    routes
})

export default router;